package com.haoran.dwz.common.security;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.haoran.dwz.common.handler.PermissionCacheHandler;

/**
 * 本地缓存 单节点使用 集群不可以使用
 */
@Component
public class UsmDefaultPermissionCacheHandler implements PermissionCacheHandler{
	
	private Logger logger = LoggerFactory.getLogger(getClass());
	
	@Autowired
	private UsmFilterInvocationSecurityMetadataSourceService usmfismss;
 

	@Override
	public boolean synchronizePermissionCache() {
		try {
			usmfismss.synchronizeSecurityMetadataSourcetToCache();
			return true;
		} catch (Exception e) {
			logger.error("同步系统权限缓存失败", e);
		}
		return false;
	}

}
